var express=require('express')
var path=require('path')
var login=require('./routers/login/login.js')
var check=require('./routers/check/check.js')
var getData=require('./routers/getData/index.js')
var setData=require('./routers/setDate/index.js')
var business=require('./routers/business/index.js')
var WhiteList=require('./WhiteList.js')
var db=require('./tools/database/index.js')
var getList=require('./routers/homepageData')

let app=express()



//静态资源
app.use('/public',(req,res,next)=>{
	console.log('静态资源')
	res.setHeader("Access-Control-Allow-Origin", "*");
	res.setHeader('crossOrigin','Anonymous')
	next()
})
//检测白名单 
app.use(WhiteList)
//检测token /check
app.use(check)

app.use('/public',express.static(path.join(__dirname, 'public')));
//推荐商品
//注册 /(client||admin)/business
app.use(business)
//登陆 /logi
app.use(login)
//响应页面数据 /getdata
app.use(getData)
//数据修改 增删改 sets
app.use(setData)
app.listen(8081,()=>{
	console.log('启动成功:127.0.0.1:8081')
})
app.use(getList)